package com.tedsoft.first_group_project;

import java.util.List;

import com.tedsoft.first_group_project.Settings.GameState;
import com.tedsoft.framework.Graphics;
import com.tedsoft.framework.Input.TouchEvent;
import com.tedsoft.framework.Game;
import com.tedsoft.first_group_project.GameEngine;

public class PauseMenu {
	public void update(Game game, List<TouchEvent> touchEvents) {
    	Graphics g = game.getGraphics();
    	int len = touchEvents.size();
    	if (Settings.soundEnabled)
        	Assets.muza.pause();
    	for(int i = 0; i < len; i++) {
            TouchEvent event = touchEvents.get(i);
            if(event.type == TouchEvent.TOUCH_DOWN) {
                if(event.x > (g.getWidth()-160)/2 && event.x <= (g.getWidth()+160)/2) {
                    // RESUME
                	if(event.y > 100 && event.y <= 142) {                 
                    	if (Settings.soundEnabled)
                        	Assets.muza.play();
                    	Settings.state = GameState.Running;
                    	return;
                    }  
                	// OPTIONS
                    if(event.y > 142 && event.y < 192) {
                    Settings.opcje = true;	
                    	return;
                    }
                    // RESTART MOZLIWOSC BUGZA!!
                    if(event.y > 192 && event.y < 232) {
                    	Assets.muza.stop();
                    	game.setScreen(new MainGameScreen(game));                   
                    	Settings.state = GameState.Running;
                    	return;
                    }
                    // QUIT
                    if(event.y > 232 && event.y < 275) {
                    	Assets.muza.stop();
                    	game.setScreen(new SplashScreen(game));                        
                    	Settings.state = GameState.Running;
                    	return;
                    }
                }
            }
        }	
    }
	public void rysuj(Graphics g){     
        g.drawPixmap(Assets.pausemenu, (g.getWidth()-160)/2, 100);
    }
}
